"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_workTask_index = require("../../../api/workTask/index.js");
if (!Array) {
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
  const _easycom_up_empty2 = common_vendor.resolveComponent("up-empty");
  const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
  const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_icon2 + _easycom_up_input2 + _easycom_up_tabs2 + _easycom_up_empty2 + _easycom_up_gap2 + _easycom_up_datetime_picker2 + _easycom_up_toast2)();
}
const _easycom_up_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up_input = () => "../../../node-modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_tabs = () => "../../../node-modules/uview-plus/components/u-tabs/u-tabs.js";
const _easycom_up_empty = () => "../../../node-modules/uview-plus/components/u-empty/u-empty.js";
const _easycom_up_gap = () => "../../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_datetime_picker = () => "../../../node-modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_icon + _easycom_up_input + _easycom_up_tabs + _easycom_up_empty + _easycom_up_gap + _easycom_up_datetime_picker + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "workReminder",
  setup(__props) {
    const uToastRef = common_vendor.ref(null);
    const data = common_vendor.reactive({
      value1: Number(/* @__PURE__ */ new Date()),
      queryParam: {
        workTime: common_vendor.dayjs(/* @__PURE__ */ new Date()).format("YYYY年MM月"),
        readStatus: 0
        // 0未读 全部传空
      },
      list: []
    });
    const { value1, queryParam, list } = common_vendor.toRefs(data);
    const showTimeSelect = common_vendor.ref(false);
    const newsTab = common_vendor.reactive([{ name: "未阅（0）" }, { name: "全部（0）" }]);
    const onTypeItem = (item) => {
      if (item.index == 0) {
        queryParam.value.readStatus = 0;
      } else {
        queryParam.value.readStatus = "";
      }
      getWorkTaskList();
    };
    const selectTime = (item) => {
      showTimeSelect.value = false;
      queryParam.value.workTime = common_vendor.dayjs(item.value).format("YYYY年MM月");
      getWorkTaskList();
    };
    const getWorkTaskList = () => {
      common_vendor.index.showLoading({
        title: "加载中",
        mask: true
      });
      api_workTask_index.listWorkPolice(queryParam.value).then((res) => {
        common_vendor.index.hideLoading();
        const { data: data2 } = res;
        newsTab[0].name = `未阅（${data2.noReadCount}）`;
        newsTab[1].name = `全部（${data2.allCount}）`;
        list.value = data2.taskList ?? [];
      }).catch((err) => {
        common_vendor.index.hideLoading();
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    common_vendor.onLoad(() => {
      getWorkTaskList();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          name: "arrow-down",
          color: "#000000",
          size: "18"
        }),
        b: common_vendor.o(($event) => showTimeSelect.value = true),
        c: common_vendor.o(($event) => common_vendor.unref(queryParam).workTime = $event),
        d: common_vendor.p({
          disabled: true,
          disabledColor: "#ffffff",
          placeholder: "请选择",
          border: "none",
          color: "#000000",
          placeholderStyle: "{color: '#707070'}",
          modelValue: common_vendor.unref(queryParam).workTime
        }),
        e: common_vendor.o(onTypeItem),
        f: common_vendor.p({
          list: common_vendor.unref(newsTab),
          lineColor: "#0A8CFE",
          lineWidth: "70rpx",
          activeStyle: {
            color: "#0A8CFE",
            fontSize: "29rpx"
          },
          inactiveStyle: {
            color: "#000",
            fontSize: "29rpx"
          }
        }),
        g: common_vendor.unref(list).length
      }, common_vendor.unref(list).length ? {
        h: common_vendor.f(common_vendor.unref(list), (item, index, i0) => {
          return {
            a: common_vendor.t(item.workItem),
            b: common_vendor.t(item.createTime ? common_vendor.unref(common_vendor.dayjs)(item.createTime).format("YYYY-MM-DD hh:mm:ss") : ""),
            c: index
          };
        })
      } : {
        i: common_vendor.p({
          mode: "data",
          text: "暂无记录",
          icon: "http://cdn.uviewui.com/uview/empty/data.png"
        })
      }, {
        j: common_vendor.p({
          height: "1"
        }),
        k: common_vendor.o(selectTime),
        l: common_vendor.o(($event) => showTimeSelect.value = false),
        m: common_vendor.o(($event) => showTimeSelect.value = false),
        n: common_vendor.o(($event) => common_vendor.isRef(value1) ? value1.value = $event : null),
        o: common_vendor.p({
          show: common_vendor.unref(showTimeSelect),
          mode: "year-month",
          format: "YYYY年MM月",
          closeOnClickOverlay: true,
          modelValue: common_vendor.unref(value1)
        }),
        p: common_vendor.sr(uToastRef, "2a1697ce-6", {
          "k": "uToastRef"
        })
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2a1697ce"]]);
wx.createPage(MiniProgramPage);
